home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / crossword / includes / cwreqhandler.i < prev    next >
Encoding:
Text File  |  1980-01-04  |  17.2 KB  |  873 lines

  1.  
  2.  
  3. * Code include file for handling "New Crossword" requester.
  4. * Contains all the routines linked to the CWNewReq.i gadgets.
  5.  
  6.  
  7. * BusyWait(d0)
  8. * d0 = wait time
  9.  
  10. * d0 corrupt
  11.  
  12. BusyWait        subq.l    #1,d0
  13.         bne.s    BusyWait
  14.         rts
  15.  
  16.  
  17. * ResetAcross(a6)
  18.  
  19. * a6 = ptr to main program variables
  20.  
  21. * Set Across size string gadget.
  22. * Called by LOTS of routines!
  23.  
  24. * d0-d2/a0-a2 corrupt
  25.  
  26.  
  27. ResetAcross    lea    NC_AC(pc),a1    ;ptr to gadget
  28.         move.l    mw_handle(a6),a0    ;ptr to main window handle
  29.  
  30.         moveq    #1,d0        ;remove 1 gadget
  31.         CALLINT    RemoveGList
  32.  
  33.         lea    NC_AC(pc),a0
  34.         move.l    gg_SpecialInfo(a0),a0    ;ptr to si_ struct
  35.         move.l    si_Buffer(a0),a0        ;ptr to buffer to alter
  36.  
  37.         move.w    tmp_across(a6),d0        ;value to use
  38.         moveq    #2,d1            ;fieldwidth
  39.  
  40.         bsr    ItoA            ;int to ASCII string
  41.  
  42.         lea    NC_AC(pc),a1
  43.         move.l    mw_handle(a6),a0
  44.         move.l    ThisReq(a6),a2
  45.  
  46.         move.l    rhb_Requester(a2),a2
  47.  
  48.         moveq    #7,d0            ;8th position in
  49.         moveq    #1,d1            ;gadget list, 1 gadget
  50.  
  51.         CALLINT    AddGList            ;add it in
  52.  
  53.         lea    NC_AC(pc),a0
  54.         move.l    mw_handle(a6),a1
  55.         move.l    ThisReq(a6),a2
  56.  
  57.         move.l    rhb_Requester(a2),a2
  58.  
  59.         moveq    #1,d0
  60.  
  61.         CALLINT    RefreshGList    ;now display new status
  62.  
  63.         rts
  64.  
  65.  
  66. * ResetDown(a6)
  67.  
  68. * a6 = ptr to main program variables
  69.  
  70. * Set Down size string gadget.
  71. * Called by LOTS of routines!
  72.  
  73.  
  74. ResetDown    lea    NC_DN(pc),a1    ;ptr to gadget
  75.         move.l    mw_handle(a6),a0    ;ptr to main window handle
  76.  
  77.         moveq    #1,d0        ;remove 1 gadget
  78.         CALLINT    RemoveGList
  79.  
  80.         lea    NC_DN(pc),a0
  81.         move.l    gg_SpecialInfo(a0),a0    ;ptr to si_ struct
  82.         move.l    si_Buffer(a0),a0        ;ptr to buffer to alter
  83.  
  84.         move.w    tmp_down(a6),d0        ;value to use
  85.         moveq    #2,d1            ;fieldwidth
  86.  
  87.         bsr    ItoA            ;int to ASCII string
  88.  
  89.         lea    NC_DN(pc),a1
  90.         move.l    mw_handle(a6),a0
  91.         move.l    ThisReq(a6),a2
  92.  
  93.         move.l    rhb_Requester(a2),a2
  94.  
  95.         moveq    #7,d0            ;8th position in
  96.         moveq    #1,d1            ;gadget list, 1 gadget
  97.  
  98.         CALLINT    AddGList            ;add it in
  99.  
  100.         lea    NC_DN(pc),a0
  101.         move.l    mw_handle(a6),a1
  102.         move.l    ThisReq(a6),a2
  103.  
  104.         move.l    rhb_Requester(a2),a2
  105.  
  106.         moveq    #1,d0
  107.  
  108.         CALLINT    RefreshGList    ;now display new status
  109.  
  110.         rts
  111.  
  112.  
  113. * SetAcross(a6)
  114. * a6 = ptr to main program variables
  115.  
  116. * Sets temporary across size for provisional new grid
  117. * to be converted to REAL across size later.
  118.  
  119. * Gets info from Across string gadget
  120.  
  121. * d0/a0 corrupt
  122.  
  123.  
  124. SetAcross    lea    NC_AC(pc),a0    ;get ptr to NC_AC gadget
  125.  
  126.         move.l    gg_SpecialInfo(a0),a0
  127.  
  128.         move.l    si_LongInt(a0),d0
  129.  
  130.         move.w    d0,tmp_across(a6)
  131.  
  132.         rts
  133.  
  134.  
  135. * SetDown(a6)
  136. * a6 = ptr to main program variables
  137.  
  138. * Sets temporary down size for provisional new grid
  139. * to be converted to REAL down size later.
  140.  
  141. * Gets info from Down string gadget
  142.  
  143. * d0/a0 corrupt
  144.  
  145.  
  146. SetDown        lea    NC_DN(pc),a0    ;get ptr to NC_DN gadget
  147.  
  148.         move.l    gg_SpecialInfo(a0),a0
  149.  
  150.         move.l    si_LongInt(a0),d0
  151.  
  152.         move.w    d0,tmp_down(a6)
  153.  
  154.         rts
  155.  
  156.  
  157. * ChangeAcross(a6)
  158. * a6 = ptr to main program variables
  159.  
  160. * Change across size of new grid while in contact
  161. * with the horizontal change gadget.
  162.  
  163. * d0-d2/a0-a2/a5 corrupt
  164.  
  165.  
  166. ChangeAcross    lea    NC_HPot(pc),a0        ;ptr to gadget
  167.         move.l    gg_SpecialInfo(a0),a0    ;ptr to PropInfo
  168.         move.l    a0,a5            ;make permanent ptr
  169.  
  170. CAC_1        moveq    #0,d0
  171.         move.l    d0,d1
  172.  
  173.         move.w    pi_HorizPot(a5),d0
  174.         move.w    pi_HorizBody(a5),d1
  175.  
  176.         divu    d1,d0    ;create across value
  177.  
  178.         cmp.w    #MINSQ_X,d0    ;less than minimum value?
  179.         bcc.s    CAC_2        ;skip if not
  180.         moveq    #3,d0        ;else set minimum
  181.  
  182. CAC_2        move.w    d0,tmp_across(a6)    ;& set it
  183.  
  184.  
  185. * Now alter status of the String gadget associated with the
  186. * Across size of the propsed new grid.
  187.  
  188.  
  189.         bsr    ResetAcross
  190.  
  191.  
  192. * Now check if PropGadget is still being played with, and if so
  193. * go back & change the value again. Note that the KNOBHIT flag is
  194. * NOT cleared if the slider is released! The mouse button must be
  195. * tested for instead. 
  196.  
  197.  
  198.         move.w    pi_Flags(a5),d0    ;check PropInfo flags
  199.         and.w    #KNOBHIT,d0    ;did we click on the knob?
  200.         beq.s    CAC_Done        ;skip if not (clicked in box)
  201.  
  202.         btst    #6,$BFE001    ;mouse button pressed?
  203.         beq.s    CAC_1        ;skip back if so
  204.  
  205. CAC_Done        rts            ;finished with this gadget!
  206.  
  207.  
  208. * ChangeDown(a6)
  209. * a6 = ptr to main program variables
  210.  
  211. * Change down size of new grid while in contact
  212. * with the vertical change gadget.
  213.  
  214. * d0-d2/a0-a2/a5 corrupt
  215.  
  216.  
  217. ChangeDown    lea    NC_VPot(pc),a0        ;ptr to gadget
  218.         move.l    gg_SpecialInfo(a0),a0    ;ptr to PropInfo
  219.         move.l    a0,a5            ;make permanent ptr
  220.  
  221. CDN_1        moveq    #0,d0
  222.         move.l    d0,d1
  223.  
  224.         move.w    pi_VertPot(a5),d0
  225.         move.w    pi_VertBody(a5),d1
  226.  
  227.         divu    d1,d0    ;create across value
  228.         neg.w    d0
  229.         add.w    #MAXSQ_Y,d0    ;inverted gadget Y axis!
  230.  
  231.         cmp.w    #MINSQ_Y,d0    ;less than minimum value?
  232.         bcc.s    CDN_2        ;skip if not
  233.         moveq    #3,d0        ;else set minimum
  234.  
  235. CDN_2        move.w    d0,tmp_down(a6)    ;& set it
  236.  
  237.  
  238. * Now alter status of the String gadget associated with the
  239. * Down size of the propsed new grid.
  240.  
  241.  
  242.         bsr    ResetDown
  243.  
  244.  
  245. * Now check if PropGadget is still being played with, and if so
  246. * go back & change the value again. Note that the KNOBHIT flag is
  247. * NOT cleared if the slider is released! The mouse button must be
  248. * tested for instead. 
  249.  
  250.  
  251.         move.w    pi_Flags(a5),d0    ;check PropInfo flags
  252.         and.w    #KNOBHIT,d0    ;did we click on the knob?
  253.         beq.s    CDN_Done        ;skip if not (clicked in box)
  254.  
  255.         btst    #6,$BFE001    ;mouse button pressed?
  256.         beq.s    CDN_1        ;skip back if so
  257.  
  258. CDN_Done        rts            ;finished with this gadget!
  259.  
  260.  
  261. * IncAcross(a6)
  262. * a6 = ptr to main program variables
  263.  
  264. * Add 1 to current Across size of proposed new grid
  265. * unless size already over the limit.
  266.  
  267. * d0-d2/a0-a2 corrupt
  268.  
  269.  
  270. IncAcross    move.w    tmp_across(a6),d0    ;get Across size
  271.  
  272.         addq.w    #1,d0        ;increase Across size
  273.  
  274.         cmp.w    #MAXSQ_X,d0    ;over the limit?
  275.         bhi.s    IncAc_1        ;skip if so
  276.  
  277.         move.w    d0,tmp_across(a6)    ;else set new value
  278.  
  279. IncAc_1        bsr    ResetAcross    ;set string gadget
  280.         bsr    SetHVPots1
  281.  
  282.         move.l    #HANG1,d0
  283.         bsr    BusyWait
  284.  
  285.         btst    #6,$BFE001    ;mouse held down?
  286.         beq.s    IncAcross    ;back for more if so
  287.  
  288.         rts            ;else done
  289.  
  290.  
  291. * IncDown(a6)
  292. * a6 = ptr to main program variables
  293.  
  294. * add 1 to current Down size of proposed new grid
  295. * unless size already over the limit.
  296.  
  297. * d0-d2/a0-a2 corrupt
  298.  
  299.  
  300. IncDown        move.w    tmp_down(a6),d0    ;get Down size
  301.  
  302.         addq.w    #1,d0        ;increase Down size
  303.  
  304.         cmp.w    #MAXSQ_Y,d0    ;over the limit?
  305.         bhi.s    IncDn_1        ;skip if so
  306.  
  307.         move.w    d0,tmp_down(a6)    ;else set new value
  308.  
  309. IncDn_1        bsr    ResetDown    ;set string gadget
  310.         bsr    SetHVPots1
  311.  
  312.         move.l    #HANG1,d0
  313.         bsr    BusyWait
  314.  
  315.         btst    #6,$BFE001    ;mouse held down?
  316.         beq.s    IncDown        ;back for more if so
  317.  
  318.         rts            ;else done
  319.  
  320.  
  321. * DecAcross(a6)
  322. * a6 = ptr to main program variables
  323.  
  324. * Subtract 1 from current Across size of proposed new grid
  325. * unless size already under the limit.
  326.  
  327. * d0-d2/a0-a2 corrupt
  328.  
  329.  
  330. DecAcross    move.w    tmp_across(a6),d0    ;get Across size
  331.  
  332.         subq.w    #1,d0        ;increase Across size
  333.  
  334.         cmp.w    #MINSQ_X,d0    ;under the limit?
  335.         bcs.s    DecAc_1        ;skip if so
  336.  
  337.         move.w    d0,tmp_across(a6)    ;else set new value
  338.  
  339. DecAc_1        bsr    ResetAcross    ;set string gadget
  340.         bsr    SetHVPots1
  341.  
  342.         move.l    #HANG1,d0
  343.         bsr    BusyWait
  344.  
  345.         btst    #6,$BFE001    ;mouse held down?
  346.         beq.s    DecAcross    ;back for more if so
  347.  
  348.         rts            ;else done
  349.  
  350.  
  351. * DecDown(a6)
  352. * a6 = ptr to main program variables
  353.  
  354. * Subtract 1 from current Down size of proposed new grid
  355. * unless size already under the limit.
  356.  
  357. * d0-d2/a0-a2 corrupt
  358.  
  359.  
  360. DecDown        move.w    tmp_down(a6),d0    ;get Down size
  361.  
  362.         subq.w    #1,d0        ;increase Down size
  363.  
  364.         cmp.w    #MINSQ_Y,d0    ;over the limit?
  365.         bcs.s    DecDn_1        ;skip if so
  366.  
  367.         move.w    d0,tmp_down(a6)    ;else set new value
  368.  
  369. DecDn_1        bsr    ResetDown    ;set string gadget
  370.         bsr    SetHVPots1
  371.  
  372.         move.l    #HANG1,d0
  373.         bsr    BusyWait
  374.  
  375.         btst    #6,$BFE001    ;mouse held down?
  376.         beq.s    DecDown        ;back for more if so
  377.  
  378.         rts            ;else done
  379.  
  380.  
  381. * The following routines are linked to the main gadgets
  382. * attached to the BackDrop window. They handle scrolling
  383. * of the crossword grid.
  384.  
  385.  
  386. * IncHScr(a6)
  387. * a6 = ptr to main program variables
  388.  
  389. * Scroll crossword grid 1 square to the right
  390. * unless extreme right hand edge of grid already hit.
  391. * Checks to see if grid large enough to be scrolled,
  392. * and exits if not.
  393.  
  394. * d0-d2/a0-a2 corrupt
  395.  
  396.  
  397. IncHScr        bset    #2,applic_flag2(a6)    ;hold InfoReq
  398.         bsr    SGHelp
  399.         beq.s    IHSZ_1
  400.  
  401.         cmp.w    #MAX_DISPX,grid_across(a6)
  402.         bhi.s    IncHScr_2
  403.  
  404. IHSZ_1        rts
  405.  
  406. IncHScr_2    move.w    grid_firstx(a6),d0    ;get TLC X position
  407.  
  408.         addq.w    #1,d0            ;move 1 square right
  409.  
  410.         move.w    d0,d1
  411.         add.w    #MAX_DISPX,d1    ;check if hit extreme RHS
  412.         subq.w    #1,d1        ;correct for LHS=1
  413.  
  414.         cmp.w    grid_across(a6),d1    ;Hit right edge?
  415.         bhi.s    IncHScr_1        ;skip if so
  416.  
  417.         move.w    d0,grid_firstx(a6)    ;else set new value
  418.  
  419.         lea    ScrHPG(pc),a0
  420.         move.l    gg_SpecialInfo(a0),a1
  421.         move.w    pi_HorizBody(a1),d1    ;copy Body to Pot
  422.         move.w    d1,d3            ;this is true Body
  423.         subq.w    #1,d0            ;conform to Pot value
  424.         mulu    d0,d1            ;this is true Pot
  425.         moveq    #-1,d2            ;these are VPot
  426.         move.l    d2,d4            ;and VBody
  427.         moveq    #1,d5            ;no. to refresh
  428.  
  429.         move.w    #FREEHORIZ+PROPBORDERLESS,d0
  430.  
  431.         move.l    mw_handle(a6),a1
  432.         sub.l    a2,a2
  433.         CALLINT    NewModifyProp
  434.  
  435. IncHScr_1    bsr    DisplayGrid    ;show new grid area
  436.  
  437.         move.l    #HANG2,d0
  438.         bsr    BusyWait
  439.  
  440.         btst    #6,$BFE001    ;mouse held down?
  441.         beq.s    IncHScr_2    ;back for more if so
  442.  
  443.         move.l    mw_handle(a6),a0
  444.         CALLINT    ActivateWindow
  445.  
  446.         rts            ;else done
  447.  
  448.  
  449. * IncVScr(a6)
  450. * a6 = ptr to main program variables
  451.  
  452. * Scroll crossword grid 1 square down unless extreme
  453. * bottom edge already reached.
  454. * Checks to see if grid large enough to be scrolled,
  455. * and exits if not.
  456.  
  457. * d0-d2/a0-a2 corrupt
  458.  
  459.  
  460. IncVScr        bset    #2,applic_flag2(a6)    ;hold InfoReq
  461.         bsr    SGHelp
  462.         beq.s    IVSZ_1
  463.  
  464.         cmp.w    #MAX_DISPY,grid_down(a6)
  465.         bhi.s    IncVScr_2
  466.  
  467. IVSZ_1        rts
  468.  
  469. IncVScr_2    move.w    grid_firsty(a6),d0    ;get TLC Y position
  470.  
  471.         addq.w    #1,d0        ;move 1 square down
  472.  
  473.         move.w    d0,d1
  474.         add.w    #MAX_DISPY,d1    ;check if hit hit extreme bottom
  475.         subq.w    #1,d1        ;correct for top=1
  476.  
  477.         cmp.w    grid_down(a6),d1    ;hit bottom edge?
  478.         bhi.s    IncVScr_1    ;skip if so
  479.  
  480.         move.w    d0,grid_firsty(a6)    ;else set new value
  481.  
  482.         lea    ScrVPG(pc),a0
  483.         move.l    gg_SpecialInfo(a0),a1
  484.         move.w    pi_VertBody(a1),d2    ;copy Body to Pot
  485.         move.w    d2,d4            ;this is true Body
  486.         subq.w    #1,d0            ;conform to Pot value
  487.         mulu    d0,d2            ;this is true Pot
  488.         moveq    #-1,d1            ;these are HPot
  489.         move.l    d2,d3            ;and HBody
  490.         moveq    #1,d5            ;no. to refresh
  491.  
  492.         move.w    #FREEVERT+PROPBORDERLESS,d0
  493.  
  494.         move.l    mw_handle(a6),a1
  495.         sub.l    a2,a2
  496.         CALLINT    NewModifyProp
  497.  
  498. IncVScr_1    bsr    DisplayGrid    ;show new grid area
  499.  
  500.         move.l    #HANG2,d0
  501.         bsr    BusyWait
  502.  
  503.         btst    #6,$BFE001    ;mouse held down?
  504.         beq.s    IncVScr_2    ;back for more if so
  505.  
  506.         move.l    mw_handle(a6),a0
  507.         CALLINT    ActivateWindow
  508.  
  509.         rts            ;else done
  510.  
  511.  
  512. * DecHSCr(a6)
  513. * a6 = ptr to main program variables
  514.  
  515. * Scroll crossword grid 1 square to the left
  516. * unless extreme left hand edge already reached.
  517. * Checks to see if grid large enough to be scrolled,
  518. * and exits if not.
  519.  
  520. * d0-d2/a0-a2 corrupt
  521.  
  522.  
  523. DecHScr        bset    #2,applic_flag2(a6)    ;hold InfoReq
  524.         bsr    SGHelp
  525.         beq.s    DHSZ_1
  526.  
  527.         cmp.w    #MAX_DISPX,grid_across(a6)
  528.         bhi.s    DecHScr_2
  529.  
  530. DHSZ_1        rts
  531.  
  532. DecHScr_2    move.w    grid_firstx(a6),d0    ;get TLC X position
  533.  
  534.         subq.w    #1,d0        ;move 1 square to the left
  535.         beq.s    DecHScr_1    ;skip if hit left edge
  536.  
  537.         move.w    d0,grid_firstx(a6)    ;else set new value
  538.  
  539.         lea    ScrHPG(pc),a0
  540.         move.l    gg_SpecialInfo(a0),a1
  541.         move.w    pi_HorizBody(a1),d1    ;copy Body to Pot
  542.         move.w    d1,d3            ;this is true Body
  543.         subq.w    #1,d0            ;conform to Pot value
  544.         mulu    d0,d1            ;this is true Pot
  545.         moveq    #-1,d2            ;these are VPot
  546.         move.l    d2,d4            ;and VBody
  547.         moveq    #1,d5            ;no. to refresh
  548.  
  549.         move.w    #FREEHORIZ+PROPBORDERLESS,d0
  550.  
  551.         move.l    mw_handle(a6),a1
  552.         sub.l    a2,a2
  553.         CALLINT    NewModifyProp
  554.  
  555. DecHScr_1    bsr    DisplayGrid    ;show new grid area
  556.  
  557.         move.l    #HANG2,d0
  558.         bsr    BusyWait
  559.  
  560.         btst    #6,$BFE001    ;mouse held down?
  561.         beq.s    DecHScr_2    ;back for more if so
  562.  
  563.         move.l    mw_handle(a6),a0
  564.         CALLINT    ActivateWindow
  565.  
  566.         rts            ;else done
  567.  
  568.  
  569. * DecVScr(a6)
  570. * a6 = ptr to main program variables
  571.  
  572. * Scroll crossword grid 1 square up
  573. * unless extreme top edge already reached.
  574. * Checks to see if grid large enough to be scrolled,
  575. * and exits if not.
  576.  
  577. * d0-d2/a0-a2 corrupt
  578.  
  579.  
  580. DecVScr        bset    #2,applic_flag2(a6)    ;hold InfoReq
  581.         bsr    SGHelp
  582.         beq.s    DVSZ_1
  583.  
  584.         cmp.w    #MAX_DISPY,grid_down(a6)
  585.         bhi.s    DecVScr_2
  586.  
  587. DVSZ_1        rts
  588.  
  589. DecVScr_2    move.w    grid_firsty(a6),d0    ;get TLC Y position
  590.  
  591.         subq.w    #1,d0        ;move 1 square up
  592.         beq.s    DecVScr_1    ;skip if hit top edge
  593.  
  594.         move.w    d0,grid_firsty(a6)    ;else set new value
  595.  
  596.         lea    ScrVPG(pc),a0
  597.         move.l    gg_SpecialInfo(a0),a1
  598.         move.w    pi_VertBody(a1),d2    ;copy Body to Pot
  599.         move.w    d2,d4            ;this is true Body
  600.         subq.w    #1,d0            ;conform to Pot value
  601.         mulu    d0,d2            ;this is true Pot
  602.         moveq    #-1,d1            ;these are HPot
  603.         move.l    d2,d3            ;and HBody
  604.         moveq    #1,d5            ;no. to refresh
  605.  
  606.         move.w    #FREEVERT+PROPBORDERLESS,d0
  607.  
  608.         move.l    mw_handle(a6),a1
  609.         sub.l    a2,a2
  610.         CALLINT    NewModifyProp
  611.  
  612. DecVScr_1    bsr    DisplayGrid    ;show new area
  613.  
  614.         move.l    #HANG2,d0
  615.         bsr    BusyWait
  616.  
  617.         btst    #6,$BFE001    ;mouse held down?
  618.         beq.s    DecVScr_2    ;back for more if so
  619.  
  620.         move.l    mw_handle(a6),a0
  621.         CALLINT    ActivateWindow
  622.  
  623.         rts            ;else done
  624.  
  625.  
  626. * NewModifyProp (Gad,Win,Req,Flags,HPot,VPot,HBody,VBody,NumGad)
  627. *        a0  a1  a2   d0   d1   d2   d3     d4   d5
  628.  
  629.  
  630. * SetMainHVPots(a6)
  631. * a6 = ptr to main program variables
  632.  
  633. * Set the pot values for the main window slider gadgets
  634. * according to the current values of the grid size, and
  635. * save the scroll values
  636.  
  637. * d0-d5/a0-a1 corrupt
  638.  
  639.  
  640. SetMainHVPots    move.w    grid_across(a6),d1    ;get across size
  641.  
  642.         sub.w    #MAX_DISPX,d1    ;too small to scroll?
  643.         bmi.s    SMHV_1        ;skip if so
  644.         beq.s    SMHV_1
  645.  
  646.         addq.w    #1,d1
  647.         move.w    d1,grid_hscrl(a6)    ;save this value
  648.         bra.s    SMHV_2        ;and set the PropGadget
  649.  
  650. SMHV_1        moveq    #0,d1
  651.         move.w    d1,grid_hscrl(a6)    ;use this instead
  652.         moveq    #1,d1
  653.  
  654. SMHV_2        moveq    #1,d2
  655.         neg.w    d2
  656.         divu    d1,d2        ;create HBody value
  657.         move.w    d2,d3
  658.         moveq    #0,d1        ;create HPot value
  659.  
  660.         moveq    #-1,d2        ;VPot, VBody not used
  661.         move.w    d2,d4
  662.  
  663.         move.w    #FREEHORIZ+PROPBORDERLESS,d0    ;flags
  664.  
  665.         moveq    #1,d5        ;only 1 gadget to refresh
  666.  
  667.         lea    ScrHPG(pc),a0    ;act upon this gadget
  668.  
  669.         move.l    mw_handle(a6),a1    ;this window
  670.         sub.l    a2,a2        ;no requester
  671.  
  672.         CALLINT    NewModifyProp
  673.  
  674.         move.w    #1,grid_firstx(a6)    ;and set TLC X position
  675.  
  676.  
  677.         move.w    grid_down(a6),d1        ;get down size
  678.  
  679.         sub.w    #MAX_DISPY,d1    ;too small to scroll?
  680.         bmi.s    SMHV_3        ;skip if so
  681.         beq.s    SMHV_3
  682.  
  683.         addq.w    #1,d1
  684.         move.w    d1,grid_vscrl(a6)    ;save this value
  685.         bra.s    SMHV_4        ;and set the PropGadget
  686.  
  687. SMHV_3        moveq    #0,d1
  688.         move.w    d1,grid_vscrl(a6)    ;use this instead
  689.         moveq    #1,d1
  690.  
  691. SMHV_4        moveq    #1,d2
  692.         neg.w    d2
  693.         divu    d1,d2        ;create VBody value
  694.         move.w    d2,d4
  695.         moveq    #0,d2        ;create VPot value
  696.  
  697.         moveq    #0,d1        ;HPot, HBody not used
  698.         moveq    #-1,d3
  699.  
  700.         move.w    #FREEVERT+PROPBORDERLESS,d0    ;flags
  701.  
  702.         moveq    #1,d5        ;only 1 gadget to refresh
  703.  
  704.         lea    ScrVPG(pc),a0    ;act upon this gadget
  705.  
  706.         move.l    mw_handle(a6),a1    ;this window
  707.         sub.l    a2,a2        ;no requester
  708.  
  709.         CALLINT    NewModifyProp
  710.  
  711.         move.w    #1,grid_firsty(a6)    ;and set TLC Y position
  712.  
  713.         rts
  714.  
  715.  
  716. * ScrollHoriz(a6)
  717. * a6 = ptr to main program variables
  718.  
  719. * Scroll crossword grid using the horizontal PropGadget.
  720. * Only perform the scroll if grid big enough to (no
  721. * more small grid hiccups).
  722.  
  723. * d0-d5/a0/a5 corrupt
  724.  
  725.  
  726. ScrollHoriz    lea    ScrHPG(pc),a0
  727.         move.l    gg_SpecialInfo(a0),a0
  728.         move.w    pi_Flags(a0),d0        ;check if Knob hit
  729.         and.w    #KNOBHIT,d0
  730.         bne.s    SHZZ_2            ;skip if so
  731.  
  732.         bset    #2,applic_flag2(a6)    ;else hold InfoReq
  733.  
  734. SHZZ_2        bsr    SGHelp
  735.         beq.s    SHZZ_1
  736.  
  737.         cmp.w    #MAX_DISPX,grid_across(a6)
  738.         bhi.s    SHZ_3
  739.  
  740. SHZZ_1        rts
  741.  
  742. SHZ_3        lea    ScrHPG(pc),a0        ;ptr to gadget
  743.         move.l    gg_SpecialInfo(a0),a0    ;ptr to PropInfo
  744.         move.l    a0,a5            ;make permanent ptr
  745.  
  746. SHZ_1        moveq    #0,d0
  747.         move.l    d0,d1
  748.  
  749.         move.w    pi_HorizPot(a5),d0
  750.         move.w    pi_HorizBody(a5),d1
  751.  
  752.         divu    d1,d0    ;create TLC X value
  753.  
  754.         move.w    d0,d1    ;check if off RHS
  755.  
  756.         addq.w    #1,d0    ;make it 1 - N
  757.  
  758.         add.w    #MAX_DISPX,d1
  759.         cmp.w    grid_across(a6),d1
  760.         bls.s    SHZ_2            ;skip if not off RHS
  761.  
  762.         subq.w    #1,d0            ;else correct
  763.  
  764. SHZ_2        move.w    d0,grid_firstx(a6)    ;& set it
  765.  
  766.  
  767. * Now display the new grid area
  768.  
  769.  
  770.         bsr    DisplayGrid
  771.  
  772.  
  773. * Now check if PropGadget is still being played with, and if so
  774. * go back & change the value again. Note that the KNOBHIT flag is
  775. * NOT cleared if the slider is released! The mouse button must be
  776. * tested for instead. 
  777.  
  778.  
  779.         move.w    pi_Flags(a5),d0    ;check PropInfo flags
  780.         and.w    #KNOBHIT,d0    ;did we click on the knob?
  781.         beq.s    SHZ_Done        ;skip if not (clicked in box)
  782.  
  783.         btst    #6,$BFE001    ;mouse button pressed?
  784.         beq.s    SHZ_1        ;skip back if so
  785.  
  786. SHZ_Done        move.l    mw_handle(a6),a0
  787.         CALLINT    ActivateWindow
  788.  
  789.         rts            ;finished with this gadget!
  790.  
  791.  
  792. * ScrollVert(a6)
  793. * a6 = ptr to main program variables
  794.  
  795. * Scroll crossword grid using the vertical PropGadget.
  796. * Only perform the scroll if grid big enough to (no
  797. * more small grid hiccups).
  798.  
  799. * d0-d5/a0/a5 corrupt
  800.  
  801.  
  802. ScrollVert    lea    ScrVPG(pc),a0
  803.         move.l    gg_SpecialInfo(a0),a0
  804.         move.w    pi_Flags(a0),d0        ;check if Knob hit
  805.         and.w    #KNOBHIT,d0
  806.         bne.s    SVTZ_2            ;skip if so
  807.  
  808.         bset    #2,applic_flag2(a6)    ;hold InfoReq
  809.  
  810. SVTZ_2        bsr    SGHelp
  811.         beq.s    SVTZ_1
  812.  
  813.         cmp.w    #MAX_DISPY,grid_down(a6)
  814.         bhi.s    SVT_3
  815.  
  816. SVTZ_1        rts
  817.  
  818. SVT_3        lea    ScrVPG(pc),a0        ;ptr to gadget
  819.         move.l    gg_SpecialInfo(a0),a0    ;ptr to PropInfo
  820.         move.l    a0,a5            ;make permanent ptr
  821.  
  822. SVT_1        moveq    #0,d0
  823.         move.l    d0,d1
  824.  
  825.         move.w    pi_VertPot(a5),d0
  826.         move.w    pi_VertBody(a5),d1
  827.  
  828.         divu    d1,d0    ;create TLC Y value
  829.  
  830.         move.w    d0,d1    ;check if off bottom
  831.  
  832.         addq.w    #1,d0    ;make it 1 - N
  833.  
  834.         add.w    #MAX_DISPY,d1
  835.         cmp.w    grid_down(a6),d1
  836.         bls.s    SVT_2            ;skip if not off bottom
  837.  
  838.         subq.w    #1,d0            ;else correct
  839.  
  840. SVT_2        move.w    d0,grid_firsty(a6)    ;& set it
  841.  
  842.  
  843. * Now display the new grid area
  844.  
  845.  
  846.         bsr    DisplayGrid
  847.  
  848.  
  849. * Now check if PropGadget is still being played with, and if so
  850. * go back & change the value again. Note that the KNOBHIT flag is
  851. * NOT cleared if the slider is released! The mouse button must be
  852. * tested for instead. 
  853.  
  854.  
  855.         move.w    pi_Flags(a5),d0    ;check PropInfo flags
  856.         and.w    #KNOBHIT,d0    ;did we click on the knob?
  857.         beq.s    SVT_Done        ;skip if not (clicked in box)
  858.  
  859.         btst    #6,$BFE001    ;mouse button pressed?
  860.         beq.s    SVT_1        ;skip back if so
  861.  
  862. SVT_Done        move.l    mw_handle(a6),a0
  863.         CALLINT    ActivateWindow
  864.  
  865.         rts            ;finished with this gadget!
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.